home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 235 / Issue 235 - September 2007 - DPCS0907DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / FSI / lib / nof / util / PropertyResourceBundle.js < prev    next >
Encoding:
Text File  |  2007-04-11  |  3.1 KB  |  127 lines

  1. /****i* SOURCE_FILE/INFO
  2.   *
  3.   * NAME
  4.   *  PropertyResourceBundle.js
  5.   *
  6.   * USAGE
  7.   *  Part of Netobjects JavaScript Library.
  8.   *
  9.   * COPYRIGHT
  10.   *  Copyright ⌐ 2000-2005 Website Pros, Inc.
  11.   *  All Rights Reserved.
  12.   *
  13.   *  This is an unpublished work protected by Website Pros, Inc.
  14.   *  as a trade secret, and is not to be used or disclosed except as
  15.   *  expressly provided in a written license agreement executed by
  16.   *  you and Website Pros, Inc.
  17.   *
  18.   *      <copyright@websitepros.com>
  19.   *
  20.   * NOTES
  21.   *  JavaScript code.
  22.   *
  23.   *****/
  24.  
  25. if (!IS.isModuleInitialized("IS.NOF.UTIL.PropertyResourceBundle"))
  26.   
  27.   /****h* NOF_JavaScript_Library/NOF.UTIL.PropertyResourceBundle
  28.     *
  29.     * NAME
  30.     *  NOF.UTIL.PropertyResourceBundle
  31.     *
  32.     * DESCRIPTION
  33.     *   PropertyResourceBundle manages resources using a set of static strings. 
  34.     *   See ResourceBundle for more information about resource bundles.
  35.     *
  36.     ****/
  37.   
  38.   /**
  39.     * Constructor
  40.     */    
  41.   function UTIL_PropertyResourceBundle(id){
  42.     this.__proto__ = UTIL_PropertyResourceBundle.prototype;
  43.     
  44.     this._ID = id;
  45.     this.hash = new Array();
  46.     
  47.   }
  48.   {    
  49.     var method = UTIL_PropertyResourceBundle.prototype;
  50.     /**
  51.       * Return the id attached to this set of strings.
  52.       **/
  53.     method.getID = function () { 
  54.       return ("" + this._ID);
  55.     }
  56.     
  57.     
  58.     /**
  59.       * Return the keys for this string table
  60.       **/
  61.     method.getKeys = function () {
  62.       var q = [];
  63.       var i = 0;
  64.       for (var u in this.hash){   
  65.         if (typeof(this.hash[u])!="function") {
  66.           q[i] = u;
  67.           i++;
  68.         } 
  69.       }
  70.       return q;
  71.     }
  72.     
  73.     /**
  74.       * Return the values for this string table
  75.       **/
  76.     method.getValues = function () {
  77.       var q = [];
  78.       var i = 0;
  79.       for (var u in this.hash) {
  80.         if (typeof(this.hash[u]) != "function") {
  81.           q[i] = this.hash[u];
  82.           i++;
  83.         } 
  84.       }
  85.       return q;
  86.     }
  87.     
  88.     /**
  89.       * Return the value as a JavaScript String object (not equal to a javascript string)
  90.       * assigned to 'key' or null if 'key' not found.
  91.       **/
  92.     method.getProperty = function ( /*string*/ key ) { 
  93.       return this.getString( key ); 
  94.     }
  95.     
  96.     /**
  97.       * Set the value for this key to 'value'.
  98.       **/
  99.     method.setProperty = function ( /*string*/ key, /*string*/ value ) {
  100.       this.hash[key] = value; 
  101.     }
  102.     
  103.     /**
  104.       * Return the value as a JavaScript String object (not equal to a javascript string)
  105.       * assigned to 'key' or null if 'key' not found.
  106.       **/
  107.     method.getString = function (/*string*/ key) {
  108.       val = this.getObject(key);    
  109.       if (val != null) {
  110.         return new String(val);
  111.       }
  112.       return null;
  113.     }
  114.     
  115.     method.handleGetObject     = function ( key ) {
  116.       return this.getObject( key );
  117.     }        
  118.     
  119.     // private method
  120.     method.getObject = function (key){
  121.       return this.hash[key];
  122.     }    
  123.   }
  124.   
  125.   UTIL.__proto__.PropertyResourceBundle = UTIL_PropertyResourceBundle; 
  126. }